﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mr.LinqToWeibo
{
	public static class EntityExtension
	{
		public static WeiboApi GetWeiboApi (this Scope scope)
		{
			WeiboApi templateApi = null;
			switch (scope) {
			case Scope.FRIENDS_TIMELINE:
				templateApi = WeiboApiFactory.FRIENDS_TIMELINE;
				break;
			case Scope.PUBLIC_TIMELINE:
				templateApi = WeiboApiFactory.PUBLIC_TIMELINE;
				break;
			case Scope.USER_TIMELINE:
				templateApi = WeiboApiFactory.USER_TIMELINE;
				break;
			case Scope.MENTIONS:
				templateApi = WeiboApiFactory.MENTIONS;
				break;
			case Scope.REPOST_TIMELINE:
				templateApi = WeiboApiFactory.REPOST_TIMELINE;
				break;
			case Scope.REPOST_BY_ME:
				templateApi = WeiboApiFactory.REPOST_BY_ME;
				break;
			case Scope.COMMENTS_TIMELINE:
				templateApi = WeiboApiFactory.COMMENTS_TIMELINE;
				break;
			case Scope.COMMENTS_BY_ME:
				templateApi = WeiboApiFactory.COMMENTS_BY_ME;
				break;
			case Scope.COMMENTS_TO_ME:
				templateApi = WeiboApiFactory.COMMENTS_TO_ME;
				break;
			case Scope.COMMENTS_FOR_ONE_WEIBO:
				templateApi = WeiboApiFactory.COMMENTS_FOR_ONE_WEIBO;
				break;
			case Scope.WEIBO_FOR_ONE_TRENDS:
				templateApi = WeiboApiFactory.WEIBO_FOR_ONE_TRENDS;
				break;
			}
			if (templateApi == null) {
				throw new ArgumentException ("scope have invalid value.");
			}
			return templateApi;
		}
	}
}
